﻿using RuoVea.ExDto;
using RuoVea.ExEnum;
using System.ComponentModel.DataAnnotations;

namespace RuoVea.OmiApp.Template.Dto;

/// <summary>
/// 
/// </summary>
public class SysDictTypeParam : PageParam
{
    /// <summary>
    /// 名称
    /// </summary>
    public string Name { get; set; }

    /// <summary>
    /// 编码
    /// </summary>
    public string Code { get; set; }

    /// <summary>
    /// 状态（字典 0正常 1停用）
    /// </summary>
    public StatusEnum? Status { get; set; }

}
/// <summary>
/// 
/// </summary>
public class SysDictTypeDto
{
    /// <summary>
    /// 主键Id
    /// </summary>
    public long Id { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    public DateTime? CreateTime { get; set; }

    /// <summary>
    /// 创建人
    /// </summary>
    public long? Creator { get; set; }
    /// <summary>
    /// 修改时间
    /// </summary>
    public DateTime? ModifyTime { get; set; }

    /// <summary>
    /// 修改人
    /// </summary>
    public long? Modifier { get; set; }

    /// <summary>
    /// 逻辑删除:0=未删除,1=已删除 Default:0
    /// </summary>
    public IsDelete? IsDeleted { get; set; }

    /// <summary>
    /// 名称
    /// </summary>
    [Required, MaxLength(50)]
    public string Name { get; set; }

    /// <summary>
    /// 编码
    /// </summary>
    [Required, MaxLength(50)]
    public string Code { get; set; }

    /// <summary>
    /// 排序
    /// </summary>
    public int Sort { get; set; }

    /// <summary>
    /// 备注
    /// </summary>
    [MaxLength(100)]
    public string Remark { get; set; }

    /// <summary>
    /// 状态（字典 0正常 1停用）
    /// </summary>
    public StatusEnum Status { get; set; } = StatusEnum.ENABLE;

    /// <summary>
    /// 系统内置 1是 0否
    /// </summary>
    public IsDelete IsSetting { get; set; }
}

/// <summary>
/// 
/// </summary>
public class DropDownDictTypeInput
{
    /// <summary>
    /// 编码
    /// </summary>
    [Required(ErrorMessage = "字典类型编码不能为空")]
    public string Code { get; set; }
}

/// <summary>
/// 
/// </summary>
public class ChangeStateDictTypeInput
{
    /// <summary>
    /// Id
    /// </summary>
    [Required(ErrorMessage = "字典类型Id不能为空")]
    public long Id { get; set; }

    /// <summary>
    /// 状态（字典 0正常 1停用 ）
    /// </summary>
    public StatusEnum Status { get; set; }
}


/// <summary>
/// 字典类型与字典值构造的树
/// </summary>
public class DictTreeOutput
{
    /// <summary>
    /// Id
    /// </summary>
    public long Id { get; set; }

    /// <summary>
    /// 父Id
    /// </summary>
    public long Pid { get; set; }

    /// <summary>
    /// 编码-对应字典值的编码
    /// </summary>
    public string Code { get; set; }

    /// <summary>
    /// 名称-对应字典值的value
    /// </summary>
    public string Name { get; set; }

    /// <summary>
    /// 子节点集合
    /// </summary>
    public List<DictTreeOutput> Children { get; set; } = new List<DictTreeOutput>();
}
